using System;
using System.Collections.Generic;
using System.Text;
using SDMX_Common = SDMX_ML.Framework.Common;

namespace SDMX_ML.Framework.Structure
{

    public class AttributeType
    {
        //Elements
        private List<TextFormatType> _textFormat;
        private SDMX_Common.IDType _attachmentGroup;
        private SDMX_Common.IDType _attachmentMeasure;
        private SDMX_Common.AnnotationsType _annotations;

        //Attributes
        private SDMX_Common.IDType _conceptRef; //required
        private AttachmentLevel? _attachmentLevel; //required
        private AssignmentStatus? _assignmentStatus; //required

        private string _conceptVersion;
        private SDMX_Common.IDType _conceptAgency;
        private SDMX_Common.IDType _conceptSchemeRef;
        private SDMX_Common.IDType _conceptSchemeAgency;
        private SDMX_Common.IDType _codelist;
        private string _codelistVersion;
        private SDMX_Common.IDType _codelistAgency;
        private bool? _isTimeFormat;
        private bool? _crosssectionalAttachDataset;
        private bool? _crosssectionalAttachGroup;
        private bool? _crosssectionalAttachSection;
        private bool? _crosssectionalAttachObservation;
        private bool? _isEntityAttribute;
        private bool? _isNonObservationalTimeAttribute;
        private bool? _isCountAttribute;
        private bool? _isFrequencyAttribute;
        private bool? _isIdentityAttribute;

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="conceptRef">ConceptRef.</param>
        /// <param name="attachmentLevel">AttachmentLevel.</param>
        /// <param name="assignmentStatus">AssignmentStatus.</param>
        public AttributeType(SDMX_Common.IDType conceptRef, AttachmentLevel attachmentLevel, AssignmentStatus assignmentStatus)
        {
            if (conceptRef != null)
            {
                _conceptRef = conceptRef;
            }
            else
            {
                throw new Exception("Attribute ConceptRef is a required field");
            }

            if (attachmentLevel != null)
            {
                _attachmentLevel = attachmentLevel;
            }
            else
            {
                throw new Exception("Attribute attachmentLevel is a required field");
            }

            if (assignmentStatus != null)
            {
                _assignmentStatus = assignmentStatus;
            }
            else
            {
                throw new Exception("Attribute assigmentStatus is a required field");
            }

            _textFormat = new List<TextFormatType>();
        }

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="conceptRef">ConceptRef.</param>
        /// <param name="attachmentLevel">AttachmentLevel.</param>
        /// <param name="assignmentStatus">AssignmentStatus.</param>
        public AttributeType(string conceptRef, AttachmentLevel attachmentLevel, AssignmentStatus assignmentStatus)
        {
            if (!String.IsNullOrEmpty(conceptRef))
            {
                _conceptRef = new SDMX_Common.IDType(conceptRef);
            }
            else
            {
                throw new Exception("Attribute ConceptRef is a required field");
            }

            if (attachmentLevel != null)
            {
                _attachmentLevel = attachmentLevel;
            }
            else
            {
                throw new Exception("Attribute attachmentLevel is a required field");
            }

            if (assignmentStatus != null)
            {
                _assignmentStatus = assignmentStatus;
            }
            else
            {
                throw new Exception("Attribute assigmentStatus is a required field");
            }

            _textFormat = new List<TextFormatType>();
        }

        #region Properties

        /// <summary>
        /// TextFormat.
        /// </summary>
        public List<TextFormatType> TextFormat
        {
            get { return _textFormat; }
            set { _textFormat = value; }
        }

        /// <summary>
        /// AttachmentGroup.
        /// </summary>
        public SDMX_Common.IDType AttachmentGroup
        {
            get { return _attachmentGroup; }
            set { _attachmentGroup = value; }
        }

        /// <summary>
        /// AttachmentMeasure.
        /// </summary>
        public SDMX_Common.IDType AttachmentMeasure
        {
            get { return _attachmentMeasure; }
            set { _attachmentMeasure = value; }
        }

        /// <summary>
        /// Annotations.
        /// </summary>
        public SDMX_Common.AnnotationsType Annotations
        {
            get { return _annotations; }
            set { _annotations = value; }
        }

        /// <summary>
        /// ConceptRef.
        /// </summary>
        public SDMX_Common.IDType ConceptRef
        {
            get { return _conceptRef; }
        }

        /// <summary>
        /// ConceptVersion.
        /// </summary>
        public string ConceptVersion
        {
            get { return _conceptVersion; }
            set { _conceptVersion = value; }
        }

        /// <summary>
        /// ConceptAgency.
        /// </summary>
        public SDMX_Common.IDType ConceptAgency
        {
            get { return _conceptAgency; }
            set { _conceptAgency = value; }
        }

        /// <summary>
        /// ConceptSchemeRef.
        /// </summary>
        public SDMX_Common.IDType ConceptSchemeRef
        {
            get { return _conceptSchemeRef; }
            set { _conceptSchemeRef = value; }
        }

        /// <summary>
        /// ConceptSchemeAgency.
        /// </summary>
        public SDMX_Common.IDType ConceptSchemeAgency
        {
            get { return _conceptSchemeAgency; }
            set { _conceptSchemeAgency = value; }
        }

        /// <summary>
        /// Codelist.
        /// </summary>
        public SDMX_Common.IDType Codelist
        {
            get { return _codelist; }
            set { _codelist = value; }
        }

        /// <summary>
        /// CodelistVersion.
        /// </summary>
        public string CodelistVersion
        {
            get { return _codelistVersion; }
            set { _codelistVersion = value; }
        }

        /// <summary>
        /// CodelistAgency.
        /// </summary>
        public SDMX_Common.IDType CodelistAgency
        {
            get { return _codelistAgency; }
            set { _codelistAgency = value; }
        }

        /// <summary>
        /// IsTimeFormat
        /// </summary>
        public bool? IsTimeFormat
        {
            get { return _isTimeFormat; }
            set { _isTimeFormat = value; }
        }

        /// <summary>
        /// CrossSectionalAttachDataset.
        /// </summary>
        public bool? CrossSectionalAttachDataset
        {
            get { return _crosssectionalAttachDataset; }
            set { _crosssectionalAttachDataset = value; }
        }

        /// <summary>
        /// CrossSectionalAttachGroup.
        /// </summary>
        public bool? CrossSectionalAttachGroup
        {
            get { return _crosssectionalAttachGroup; }
            set { _crosssectionalAttachGroup = value; }
        }

        /// <summary>
        /// CrossSectionalAttachSection.
        /// </summary>
        public bool? CrossSectionalAttachSection
        {
            get { return _crosssectionalAttachSection; }
            set { _crosssectionalAttachSection = value; }
        }

        /// <summary>
        /// CrossSectionalAttachObservation.
        /// </summary>
        public bool? CrossSectionalAttachObservation
        {
            get { return _crosssectionalAttachObservation; }
            set { _crosssectionalAttachObservation = value; }
        }

        /// <summary>
        /// IsEntityAttribute.
        /// </summary>
        public bool? IsEntityAttribute
        {
            get { return _isEntityAttribute; }
            set { _isEntityAttribute = value; }
        }

        /// <summary>
        /// IsNonObservationalTimeAttribute.
        /// </summary>
        public bool? IsNonObservationalTimeAttribute
        {
            get { return _isNonObservationalTimeAttribute; }
            set { _isNonObservationalTimeAttribute = value; }
        }

        /// <summary>
        /// IsCountAttribute.
        /// </summary>
        public bool? IsCountAttribute
        {
            get { return _isCountAttribute; }
            set { _isCountAttribute = value; }
        }
        
        /// <summary>
        /// IsFrequencyAttribute.
        /// </summary>
        public bool? IsFrequencyAttribute
        {
            get { return _isFrequencyAttribute; }
            set { _isFrequencyAttribute = value; }
        }
        
        /// <summary>
        /// IsIdentityAttribute.
        /// </summary>
        public bool? IsIdentityAttribute
        {
            get { return _isIdentityAttribute; }
            set { _isIdentityAttribute = value; }
        }
        
        /// <summary>
        /// Attachmentlevel.
        /// </summary>
        public AttachmentLevel? AttachmentLevel
        {
            get { return _attachmentLevel; }
        }
        
        /// <summary>
        /// Assignmentstatus.
        /// </summary>
        public AssignmentStatus? AssignmentStatus
        {
            get { return _assignmentStatus; }
        }

        #endregion
    }
}
